package com.esunrise.shop.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.esunrise.shop.common.entity.SysOrder;
import com.esunrise.shop.common.entity.SysUser;
import com.esunrise.shop.common.mapper.SysOrderMapper;
import com.esunrise.shop.common.mapper.SysUserMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("user/test")
public class UserTestController {

    @Resource
    private SysUserMapper sysUserMapper;

    @Resource
    private SysOrderMapper sysOrderMapper;

    @GetMapping("/list")
    public Object users() {
        LambdaQueryWrapper<SysUser> query = Wrappers.lambdaQuery();
        List<SysUser> sysUsers = sysUserMapper.selectList(query);
        return sysUsers;
    }

    @GetMapping("/orderList")
    public Object orderList(){
        List<SysOrder> all = sysOrderMapper.findAll();
        return all;
    }
}
